﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

namespace DigDes.DSchool.SUPS.WebApp
{
    /// <summary>
    /// Сводное описание для CargoFormImage
    /// </summary>
    public class CargoFormImage : IHttpHandler
    {

        public void ProcessRequest(HttpContext ctx)
        {
            string Cargo_ID = ctx.Request.QueryString["Cargo_ID"];
            byte[] pict = DigDes.DSchool.SUPS.DataAccess.Database.CargoWebFormLoader.loadImageFromDB(Int32.Parse(Cargo_ID));
            
            if (pict != null)
            {
                ctx.Response.ContentType = "image/png";
                ctx.Response.OutputStream.Write(pict, 0, pict.Length);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}